<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="bootstrap-5.3.0-dist/css/bootstrap.min.css">
</head>
<body>
  <div class="container mt-5">
    <div class="alert alert-success alert-dismissible" role="alert" style="display:none;">
      <strong>成功!</strong> 表单提交成功。
      <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
    </div>
    <div class="alert alert-danger alert-dismissible" role="alert" style="display:none;">
      <strong>失败!</strong> 提交表单时出错。
      <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
    </div>
    <form id="myForm">
      <div class="row mb-4">
        <label for="inputName" class="col-sm-2 col-form-label">用户名：</label>
        <div class="col-sm-8">
          <input type="text" class="form-control" id="inputName">
        </div>
      </div>
      <div class="row mb-4">
        <label for="inputPassword" class="col-sm-2 col-form-label">密码：</label>
        <div class="col-sm-8">
          <input type="password" class="form-control" id="inputPassword">
        </div>
      </div>
      <div class="text-center">
        <button type="submit" class="btn btn-primary">提交</button>
      </div>
    </form>
  </div>
  <script src="js/jquery-3.3.1.js"></script>
  <script src="bootstrap-5.3.0-dist/js/bootstrap.bundle.min.js"></script>
  <script>
    $('#myForm').submit(function (event) {
      event.preventDefault();
      var name = $('#inputName').val();
      var password = $('#inputPassword').val();
      $('.alert-success').hide();
      $('.alert-danger').hide();
      if (name === 'admin' && password === '123456'){
        $('.alert-success').show();
      } else {
        $('.alert-danger').show();
      }
    });
  </script>  
</body>
</html>